package edu.hqu.experiment3_mysql.controller;

import edu.hqu.experiment3_mysql.pojo.User;
import edu.hqu.experiment3_mysql.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/user/{id}")
    public User findById(@PathVariable("id") Long id) {
        System.out.println(id);
        System.out.println(userService.findOne(id));
        return userService.findOne(id);
    }
}
